package com.molin.IOtest.charstreamTest.buffered;

import java.io.*;
import java.util.Arrays;

public class lianxi01 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new FileReader("D:\\IdeaProjects\\BasicCode\\mIdeaTest\\src\\com\\molin\\IOtest\\charstreamTest\\buffered\\sort.txt"));
        String line;
        String result = "";
        while ((line = br.readLine()) != null) {
            result += line;
        }
        String spt[]=result.split(" ");
        int[] num =new int[spt.length];
        for (int i = 0; i < spt.length; i++) {
            num[i]=Integer.parseInt(spt[i]);
        }
        Arrays.sort(num);
        br.close();

        char[] chars=new char[num.length];
        for (int i = 0; i < num.length; i++) {
            chars[i]=(char)num[i];
        }



        BufferedWriter bw=new BufferedWriter(new FileWriter("D:\\IdeaProjects\\BasicCode\\mIdeaTest\\src\\com\\molin\\IOtest\\charstreamTest\\buffered\\sort.txt"));

        for (int i = 0; i < num.length; i++) {
            bw.write(num[i]+" ");
            bw.flush();
        }
        bw.close();
    }
}
